<template>
    <el-dialog title="撤单" :visible.sync="dialogFormVisible" append-to-body width="30%">
        <el-form ref="canleOrderForm" :model="form" :rules="rules" label-position="left">
            <el-form-item label="说明:" prop="invalidRemark">
                <el-input type="textarea" v-model="form.invalidRemark" placeholder="请输入撤单说明"></el-input>
            </el-form-item>
        </el-form>
        <div slot="footer" class="dialog-footer">
            <el-button @click="close">取 消</el-button>
            <el-button type="primary" @click="confim">确 定</el-button>
        </div>
    </el-dialog>
</template>

<script>
import * as creditApplyApi from "@/api/letterReview/creditReviewApply"
export default {
    components: {},
    props: {
    },
    data() {
        // 这里存放数据
        return {
            dialogFormVisible: false,
            form: {
                invalidType:3,
                applicationNo: '',
                invalidRemark:null,

            },
            rules: {
                invalidRemark: [
                    {required: true, message: '请输入撤单说明', trigger: 'change'},
                ]
            }
        }
    },
    // 方法集合
    methods: {
        confim() {
            this.$refs['canleOrderForm'].validate((valid) => {
                if (valid) {
                    creditApplyApi.voidOrCancelTheOrder(this.form).then(res=>{
                        this.$message.success('撤单成功')
                        this.$emit('success')
                        this.close()
                    })
                }
            })
        },
        show(applicationNo) {
            this.dialogFormVisible = true
            this.form.applicationNo = applicationNo
        },
        close() {
            this.dialogFormVisible = false
        }

    },

    // 生命周期 - 挂载完成（可以访问 DOM 元素）
    mounted() {
    },

}
</script>

<style lang="scss" scoped>
</style>
